package com.gdcp.config;

/**
 * @author 杨华京
 * @version 1.0
 * @description
 * @since 1.8
 */

//@Configuration
//// 等价于<mvc:annotation-driven/>
//@EnableWebMvc
public class MvcConfiguration  {
//implements WebMvcConfigurer
    //@Value("${kaptcha.border}")
    //private String border;
    //
    //@Value("${kaptcha.textproducer.font.names}")
    //private String fnames;
    //@Value("${kaptcha.textproducer.font.size}")
    //private String fsize;
    //@Value("${kaptcha.textproducer.font.color}")
    //private String fcolor;
    //@Value("${kaptcha.textproducer.char.string}")
    //private String cString;
    //@Value("${kaptcha.textproducer.char.length}")
    //private String clength;
    //
    //@Value("${kaptcha.image.width}")
    //private String width;
    //@Value("${kaptcha.image.height}")
    //private String height;
    //@Value("${kaptcha.noise.color}")
    //private String nColor;
    //
    //
    //@Override
    //public void addResourceHandlers(ResourceHandlerRegistry registry) {
    //    registry.addResourceHandler("/static/**")
    //            .addResourceLocations("classpath:/static/");
    //}
    //
    //
    //@Bean(name = "viewResolver")
    //public ViewResolver createViewResolver() {
    //    InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
    //    // 设置Spring 容器
    //    viewResolver.setApplicationContext(this.applicationContext);
    //    // 取消缓存
    //    viewResolver.setCache(false);
    //    // 设置解析的前缀
    //    viewResolver.setPrefix("/WEB-INF/view/");
    //    // 设置试图解析的后缀
    //    viewResolver.setSuffix(".jsp");
    //    return viewResolver;
    //}
    //
    ///**
    // * 由于web.xml不生效了，需要在这里配置Kaptcha验证码Servlet
    // */
    //@Bean
    //public ServletRegistrationBean<KaptchaServlet> servletRegistrationBean() {
    //    ServletRegistrationBean<KaptchaServlet> servlet = new ServletRegistrationBean<KaptchaServlet>(new KaptchaServlet(), "/Kaptcha");
    //    servlet.addInitParameter("kaptcha.border", border);// 无边框
    //    servlet.addInitParameter("kaptcha.textproducer.font.color", fcolor); // 字体颜色
    //    servlet.addInitParameter("kaptcha.image.width", width);// 图片宽度
    //    servlet.addInitParameter("kaptcha.textproducer.char.string", cString);// 使用哪些字符生成验证码
    //    servlet.addInitParameter("kaptcha.image.height", height);// 图片高度
    //    servlet.addInitParameter("kaptcha.textproducer.font.size", fsize);// 字体大小
    //    servlet.addInitParameter("kaptcha.noise.color", nColor);// 干扰线的颜色
    //    servlet.addInitParameter("kaptcha.textproducer.char.length", clength);// 字符个数
    //    servlet.addInitParameter("kaptcha.textproducer.font.names", fnames);// 字体
    //    return servlet;
    //}
    //
    //// Spring容器
    //private ApplicationContext applicationContext;
    //
    //@Override
    //public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
    //    this.applicationContext = applicationContext;
    //}
    //
    //@Override
    //public void addInterceptors(InterceptorRegistry registry) {
    //    registry.addInterceptor(new LoginRequiredInterceptor()).addPathPatterns("/**")
    //            .excludePathPatterns("/render","/","/render/**");
    //}
}
